<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: {2021/1/11}
 * Time: {16:14}
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\api\controller;


use app\BaseController;
use app\common\lib\Show;
use think\Exception;

class Sms extends BaseController
{
    public function code()
    {
        $phone_number = $this->request->param('phone_number', '', 'trim');
        $data = [
            "phone_number" => $phone_number
        ];
        try {
            $result = (new \app\api\business\Sms())->sendCode($data);
        } catch (Exception $e) {
            return Show::json_show(config('status.error'), $e->getMessage());
        }
        if ($result) {
            return Show::json_show(config('status.success'), "发送验证码成功");
        } else {
            return Show::json_show(config('status.error'), "发送验证码失败");
        }
    }
}